import React, { Component } from 'react';
import succ from './subCard.module.scss'
import success from '../../static/success.png'
class SubSucc extends Component {
    constructor(props) {
        super(props);
        this.state = {
            type: 1
        }
    }
    render() {
        let that = this
        function Name() {
            console.log(that.state)
            if (that.state.type == 1) {
                return <h3>父母卡</h3>
            }
            if (that.state.type == 2) {
                return <h3>伴侣卡</h3>
            }
            if (that.state.type == 3) {
                return <h3>子女卡</h3>
            }
        }
        return (
            <div className={succ.editQuota}>
                <div className={succ.center}>
                    <img src={success} className={succ.icon}></img>
                    <span>赠送成功</span>
                    <Name />
                    <p className={succ.top}>月消费上限：{this.state.price}元</p>
                    <button>通知他</button>
                </div>
            </div>
        );
    }
    componentDidMount() {
        let params = this.props.location.state
        this.setState({
            type: params.type,
            price: params.payLimit
        })
        console.log(this.state)
    }
    componentWillUnmount() {
        this.props.history.go(-2)
    }
}
export default SubSucc;